In recent years, in automobiles, there has been an increasing tendency to change a mechanically driving system to an electrically driving system by a motor in order to satisfy demands for space saving, an improvement in assembly, an improvement in controllability, and so on. As one example of the electrically driving system, as disclosed in Patent Literature 1, there is a system that drives a range switching mechanism of a vehicle by a motor. The above system is equipped with an encoder outputting a pulse signal at every predetermined angle in synchronization with the rotation of the motor, sequentially switches energization phases of the motor based on a count value of an output signal of the encoder, and rotationally drives the motor to a target position. In addition, Patent Literature 1 discloses that the count value of the output signal of the encoder is compared with a count value of a drive signal of a motor to detect an abnormality (for example, disconnection) of the encoder.